var prefix = ctx + "admin/file";

$(function() {
	var options = {
		url : prefix + "/page",
		removeUrl : prefix + "/{id}",
		sortName : "createTime",
		sortOrder : "desc",
		modalName : "文件",
		escape : true,
		columns : [{
		            title: "序号",
		            formatter: function (value, row, index) {
		         	    return $.table.serialNumber(index);
		            }
		        },
				{
					field : 'bucketName',
					title : '空间'
				},

				{
					field : 'original',
					title : '原文件名'
				},
				{
					field : 'fileName',
					title : '存储文件名'
				},
				{
					field : 'type',
					title : '文件类型'
				},
				{
					field : 'fileSize',
					title : '文件大小(byte)'
				},
				{
					field : 'createUser',
					title : '上传人'
				},
				{
					field : 'createTime',
					sortable: true,
					title : '创建时间'
				},
				{
					title : '操作',
					align : 'center',
					formatter : function(value, row, index) {
						var actions = [];
		                actions.push('<a class="btn btn-danger btn-xs ' + deleteFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
		                actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="$.common.fileNameDoDownload(\'' + row.fileName + '\')"><i class="fa fa-download"></i>下载</a>');
		                return actions.join('');
					}
				} ]
	};
	$.table.init(options);
});